package cn.shenxingbang.chatroom.controller;

import cn.shenxingbang.chatroom.entity.UserChat;
import cn.shenxingbang.chatroom.service.intf.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
public class UserChatController {

    @Autowired
    private UserService userService;

    @GetMapping("/getById")
    public UserChat getById(@RequestParam int id) {
        return userService.getById(id);
    }

    @GetMapping("/findAllUser")
    public List<UserChat> findAllUser() {
        return userService.findAllUser();
    }

    @PostMapping("/insert")
    public UserChat insert(@RequestBody UserChat userChat) {
        return userService.insert(userChat);
    }

    @PostMapping("/update")
    public UserChat update(@RequestBody UserChat userChat) {
        return userService.update(userChat);
    }

    @GetMapping("/deleteById")
    public void deleteById(@RequestParam int id) {
        userService.deleteById(id);
    }

}
